<template>
  <div class="nav-header">
    <i
      :class="isFold ? 'el-icon-s-unfold' : 'el-icon-s-fold'"
      class="fold-menu"
      @click="handleFoldClick"
    ></i>
    <div class="content">
      <div>面包屑</div>
      <div><user-info></user-info></div>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue'
import UserInfo from './user-info.vue'

export default defineComponent({
  emits: ['foldChange'],
  components: { UserInfo },
  setup(props, { emit }) {
    const isFold = ref(false)
    // 改变
    const handleFoldClick = () => {
      isFold.value = !isFold.value
      emit('foldChange', isFold.value)
    }
    return { isFold, handleFoldClick }
  },
})
</script>

<style scoped lang="less">
.nav-header {
  display: flex;
  width: 100%;
  .fold-menu {
    font-size: 30px;
    cursor: pointer;
  }
  .content {
    display: flex;
    padding: 0 20px;
    flex: 1;
    justify-content: space-between;
    align-items: center;
  }
}
</style>
